import javafx.scene.control.RadioMenuItem;

import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
public class Test {
    public static void main(String[] args){
        int[] arr1 = {1,2,3,4,5};
        int[] copy = Arrays.copyOf(arr1, arr1.length);
        int[] copy1 = Arrays.copyOfRange(arr1,2,4);
        System.out.println(Arrays.toString(copy));
        System.out.println(Arrays.toString(copy1));
    }





    private static String myString(int[] arr){
        String arr1 = "{";
        for (int x:arr
             ) {
            arr1 += x + ",";
        }
        arr1 += "}";
        return arr1;
    }

    public static void main222(String[] args){
        int[] arr1 = {1,2,3,4,5,6,7,8,9};
        System.out.println(Arrays.toString(arr1));
        System.out.println(myString(arr1));

    }



    public static int fac(int n){
        int sum = 1;
        for (int i = 1; i <= n ; i++) {
            sum *= i;
        }
        return sum;
    }
    public static int facSum(int n){
        int sum = 0;
        for (int i = 1; i <= n ; i++) {
            sum += fac(i);
        }
        return sum;
    }
    public static void main22(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println(facSum(5));
        System.out.println(facSum(2));
        System.out.println(facSum(1));


    }



    public static void mainw(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in) ;

        int count = 10;
        int Numer = random.nextInt(101);

        while(true){
            System.out.println("请输入猜的数字,机会：" + count );
            int num = scanner.nextInt();
            if(Numer > num){
                count--;
                System.out.println("猜小了" );
            }else if(Numer < num){
                count--;
                System.out.println("猜大了" );
            }else{
                System.out.println("猜对了，恭喜你");
                break;
            }
            if(count == 0){
                System.out.println("你的机会结束，游戏结束");
                break;
            }
        }

    }



    public static void main9(String[] args) {
        int num = 10000;
        int i = 0;
        String num1 = Integer.toBinaryString(num);
        System.out.println(num1);
        for(i = 31;i >= 1; i -= 2){
            System.out.print((num >> i) &1);
        }
        System.out.println();
        for(i = 30;i >= 0;i -= 2){
            System.out.print((num >> i) &1);
        }
    }



    public static void main8(String[] args) {
        int num = -1;
        int count = 0;
        while(num != 0){
            num = num & (num - 1);
            count++;
        }
        System.out.println(count);
    }

    public static void main7(String[] args) {


        //遍历每一个数字
        for(int i = 1;i < 9999999;i++){

            //计算数字位数
            int count = 0;
            int tmp = i;
            while(tmp != 0){
                tmp /= 10;
                count++;
            }

            int sum = 0;
            tmp = i;
            while(tmp != 0){
                sum += Math.pow(tmp % 10 , count);
                tmp /= 10;
            }

            if(sum == i){
                System.out.println(i);
            }
        }

    }

    public static void main6(String[] args) {

        for (int i = 100; i < 1000 ; i++) {
            int a = i % 10;
            int b = (i / 10) % 10;
            int c = i / 100;
            if(a*a*a+b*b*b+c*c*c == i){
                System.out.println(i);
            }
        }
    }


    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in) ;
        System.out.println("请输入年份");
        int year = scanner.nextInt();
        if((year % 4 == 0 && year % 100 != 0 )|| (year % 400 == 0)){
            System.out.println("是闰年");
        }else{
            System.out.println("不是闰年");

        }

    }

    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in) ;
        int num1 = scanner.nextInt();
        int num2 = scanner.nextInt();
        int z = num2;

        while(num1 % num2 != 0){
            z = num1 % num2;
            num1 = num2;
            num2 = z;
        }
        System.out.println(num2);
    }


    public static void main3(String[] args) {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.println(j + "*" + i  + "=" +  i*j);
            }
            System.out.println();
        }


    }


    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in) ;
        //int num = scanner.nextInt();

        for (int j = 1; j <= 100 ; j++) {
            int i = 2;
            for (; i <= Math.sqrt(j) ; i++) {
                if(j % i == 0){
                break;
                }
            }

        if(i > Math.sqrt(j)){
            System.out.println(j + "素数！！！");
        }

        }
    }


    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in) ;
        System.out.println("请输入你的年龄");
        int age = scanner.nextInt();
        if(age > 0 && age <= 18){

        } else if (age > 18 && age <= 28) {
            System.out.println("少年");
        } else if (age > 28 && age <= 55) {
            System.out.println("青年");
        }else if (age > 55) {
            System.out.println("老年");
        } else {
            System.out.println("输入错误");
        }

    }

}
